We are migrating the bug tracker to github Issues. This is now the preferred way to report NASM bugs.
Self-registration is disabled due to spam issue (mail gorcunov@gmail.com or hpa@zytor.com to create an account)
Created attachment 411614 [details] test case that causes the failure Using a non-trivial sample, I receive an error "assertion output_ins.times >= 0 failed" despite there still being 5 bytes available that should be filled with the "times" statement. Unfortunately, my attempts to simplify the test case have failed, it seems to disappear if the specific conditions aren't met. Thus I'm uploading my entire project that has this error. The first assembling in the following log occurred with the %fatal in line 932 in use; the second assembling is with that %fatal commented. As is visible in the first round, 503 bytes are in use, so as the macro should pad to 508, 5 bytes are left. (TIMES should get 5 as its count.) $ nasm -v NASM version 2.14rc0-20170624 compiled on Jun 24 2017 $ FSS=512 SUFFIX= FAT=12; nasm -DNUM=500 -D_DIRBUF_500=1 -D_MEMORY_CONTINUE=1 -D_RPL=0 -D_USE_PART_INFO=0 -D_QUERY_GEOMETRY=1 -D_FAT$FAT=1 boot.asm -o boot${FAT}${SUFFIX}.bin -D_MAP=boot${FAT}${SUFFIX}.map -l boot${FAT}${SUFFIX}.lst -I../lmacros/ lmacros1.mac:404: warning: unterminated string boot.asm:932: fatal: x = 503 evln@alyra:~/test/nasm/nasmbug$ FSS=512 SUFFIX= FAT=12; nasm -DNUM=500 -D_DIRBUF_500=1 -D_MEMORY_CONTINUE=1 -D_RPL=0 -D_USE_PART_INFO=0 -D_QUERY_GEOMETRY=1 -D_FAT$FAT=1 boot.asm -o boot${FAT}${SUFFIX}.bin -D_MAP=boot${FAT}${SUFFIX}.map -l boot${FAT}${SUFFIX}.lst -I../lmacros/ lmacros1.mac:404: warning: unterminated string boot.asm:935: panic: assertion output_ins.times >= 0 failed at asm/nasm.c:1342 evln@alyra:~/test/nasm/nasmbug$
I've prepared a simpler test case. I'm suspecting that the panic is caused by an early pass when it assembles things in a way that the TIMES value would be negative; eg jumps at first are assembled as near jumps. $ nasm -v NASM version 2.14rc0-20170624 compiled on Jun 24 2017 $ echo -ne 'org 0\nstart:\ntimes (508 / 2) jmp fill\nfill:\n%assign i $-$$\n%fatal i\ntimes 508-(fill-start) nop\ndd 0_AA55_0000h\n' > nasmbug.asm $ nasm -Ox nasmbug.asm -l nasmbug.lst -o nasmbug.bin nasmbug.asm:6: fatal: 508 $ nasm nasmbug.asm -l nasmbug.lst -o nasmbug.bin nasmbug.asm:6: fatal: 508 $ echo -ne 'org 0\nstart:\ntimes (508 / 2) jmp fill\nfill:\n%assign i $-$$\n;%fatal i\ntimes 508-(fill-start) nop\ndd 0_AA55_0000h\n' > nasmbug.asm $ nasm -Ox nasmbug.asm -l nasmbug.lst -o nasmbug.bin nasmbug.asm:7: panic: assertion output_ins.times >= 0 failed at asm/nasm.c:1342 $ nasm nasmbug.asm -l nasmbug.lst -o nasmbug.bin nasmbug.asm:7: panic: assertion output_ins.times >= 0 failed at asm/nasm.c:1342 $ nasm -O0 nasmbug.asm -l nasmbug.lst -o nasmbug.bin nasmbug.asm:7: panic: assertion output_ins.times >= 0 failed at asm/nasm.c:1342 $ echo -ne 'org 0\nstart:\ntimes (500 / 2) jmp fill\nfill:\n%assign i $-$$\n;%fatal i\ntimes 508-(fill-start) nop\ndd 0_AA55_0000h\n' > nasmbug.asm $ nasm -Ox nasmbug.asm -l nasmbug.lst -o nasmbug.bin nasmbug.asm:7: panic: assertion output_ins.times >= 0 failed at asm/nasm.c:1342 $ echo -ne 'org 0\nstart:\ntimes (500 / 2) jmp fill\nfill:\n%assign i $-$$\n%fatal i\ntimes 508-(fill-start) nop\ndd 0_AA55_0000h\n' > nasmbug.asm $ nasm -Ox nasmbug.asm -l nasmbug.lst -o nasmbug.bin nasmbug.asm:6: fatal: 500 $ (Attempts with shorter test cases (ie not 512 bytes of output) have failed as yet. Not sure why.)
*** This bug has been marked as a duplicate of bug 3392437 ***